package com;

import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.util.Base64;
import android.util.Log;

import com.google.gson.Gson;
import com.jy.common.BaseApplication;
import com.jy.unkown.UnkownAdManager;
import com.jy.utils.cache.SpManager;
import com.jy.utils.cache.k;
import com.jy.utils.um.Report;
import com.jy.utils.utils.LogUtils;
import com.lxj.xpopup.XPopupManager;

public class MyApp extends BaseApplication {
    @Override
    public String getAppName() {
        return "测试";
    }

    @Override
    public String getAppVersion() {
        return "1.0.9";
    }

    @Override
    public int getAppVersionCode() {
        return 109;
    }

    @Override
    public String getUmengKey() {
        return "";
    }

    @Override
    public String getWeixinAppSecret() {
        return "";
    }

    @Override
    public String getWeixinAppId() {
        return "";
    }

    @Override
    public int getDawuWidth() {
        return 320;
    }

    @Override
    public String getTongjiChannel() {
        return "test";
    }

    @Override
    public void onCreate() {
        super.onCreate();
        LogUtils.isLog=true;
        UnkownAdManager.init();
        XPopupManager.getInstance().registerManager(this);
        XPopupManager.getInstance().setCanShow(true);
        XPopupManager.getInstance().setErrLisener(new XPopupManager.ErrLisener() {
            @Override
            public void err(Exception e) {
                Report.reportError(e);
            }
        });
    }

    @Override
    public void initOtherTask() {

    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);

        ApplicationInfo applicationInfo=base.getApplicationInfo();
        Log.e("applicationInfo",""+isSystemApplication(applicationInfo));
    }

    @Override
    public boolean isDebug() {
        return true;
    }

    @Override
    public String getXAppID() {
        return null;
    }

    @Override
    public Class getLoginActivity() {
        return MainActivity.class;
    }

    @Override
    public Class getMainActivity() {
        return MainActivity.class;
    }

    @Override
    public Class<?> splashActivity() {
        return MainActivity.class;
    }

    @Override
    public boolean isCanSplashHotAD(Activity activity) {
        return false;
    }

    @Override
    public boolean isNewRegisterUser() {
        return false;
    }

    @Override
    public boolean toutiaoFenbao() {
        return true;
    }

    @Override
    public void initA4SDK() {

    }

    @Override
    protected boolean needInitInApp() {
        return false;
    }

    @Override
    protected void beforeX1() {

    }



    public static boolean isSystemApplication(ApplicationInfo applicationInfo){
        try {
            if((applicationInfo.flags & android.content.pm.ApplicationInfo.FLAG_SYSTEM)!=0){
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}
